package com.yifeng.controller;

import com.yifeng.po.Role;
import com.yifeng.service.IRoleService;
import com.yifeng.util.BlogResult;
import com.yifeng.util.LayuiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Decription :
 * author : yifeng
 * 创建时间 ：2019/1/19 :15:52
 * version : 1.0
 */
@Controller
@RequestMapping("/api/role")
public class RoleController {

    @Autowired
    private IRoleService roleService;

    @RequestMapping("/list")
    @ResponseBody
    public LayuiResult<Role> getAll(int page, int limit)
    {
        LayuiResult<Role> result = roleService.getPageAll(page, limit);
        return result;
    }

    @RequestMapping(value="/update", method= RequestMethod.POST)
    @ResponseBody
    public BlogResult updateRole(@RequestParam String roleId, @RequestParam String[] pers)
    {
        Integer result = roleService.updateRole(roleId,pers);
        return new BlogResult(200,"OK",result);
    }
}
